home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_2
/
safe_pur
< prev
next >
Wrap
Text File
|
1995-03-31
|
5KB
|
146 lines
Note: When Jason wrote this he forgot that the 48 can already undo the
last purge, but this one will work even if you do more calculation in
between.
- Wayne
From HP-48@VM1.NoDak.EDU Mon Nov 5 16:13:30 1990
Received: from vm1.NoDak.edu by en.ecn.purdue.edu (5.61/1.28jrs)
id AA15574; Mon, 5 Nov 90 16:13:30 -0500
Message-Id: <9011052113.AA15574@en.ecn.purdue.edu>
Received: from NDSUVM1.BITNET by VM1.NoDak.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 5499; Mon, 05 Nov 90 15:10:20 CST
Received: from NDSUVM1.BITNET by NDSUVM1.BITNET (Mailer R2.07) with BSMTP id
2048; Mon, 05 Nov 90 15:10:17 CST
Date: Mon, 5 Nov 90 15:46:29 EST
Reply-To: HP-48 - HP-48sx Hand Held System <HP-48@VM1.NoDak.EDU>
Sender: HP-48 - HP-48sx Hand Held System <HP-48@VM1.NoDak.EDU>
From: "Jason P. Meyers (HP-48 list owner)" <JMEYERS%MTUS5.BITNET@VM1.NoDak.EDU>
Subject: Safe Purger!
To: Multiple recipients of list HP-48 <HP-48@NDSUVM1>
Status: OR
Dear fellow list members,
In my opinion, HP left out a very important feature: "Unpurge". If I
accidently mess up the stack, I can press LAST STACK and all is fine.
However, if I purge a variable, there is no such thing. That is why I
have created the following two programs. They are both very similar and
do essentially the same thing, except that the second one is a more
powerful version of the first one.
My idea was to store what ever it is that you purge into a temporary
variable so that if you accidently purged the wrong variable, you still
have a second chance at recovering it. Obviously, like the LAST commands
this takes up some memory (ammount of which depends on what you purge).
To further help matters, I have assigned the program to my PURGE key.
Both programs have the same input specifications as the normal PURGE
command. The difference being that a copy of what is purged is stored
in the variable 'TVAR' in your HOME directory. The program will work
within any directory and will always use the 'TVAR' in the HOME directory.
This prevents the calculator from being cluttered with 'TVAR' variables.
The program will not change the current working directory.
Here is the first version of the program:
Name: SPURGE (SafePURGE)
Usage: Enter the same argument that you would use with PURGE.
Results: If you purge a single variable (either tagged or not tagged)
then the contents of the variable is stored in 'TVAR' in the
HOME directory (thus purging the previous value of 'TVAR')
and purge the original variable. However, if the argument is
a list of variables to be purged or if you purge the PICT then
the item is purged without preserving a copy of it and the old
value of 'TVAR' remains unchanged.
Downloadable program:
-------------------8<------------------8<------------------8<---------
%%HP: T(3)A(R)F(.);
\<< DUP TYPE \-> n t
\<<
IF t 12 ==
THEN n OBJ\->
DROP TYPE 't' STO
END
IF t 5 == t 19
== OR
THEN n PURGE
ELSE PATH n RCL
n PURGE HOME 'TVAR'
STO EVAL
END
\>>
\>>
-------------------8<------------------8<------------------8<--------
Here is the second version of the program:
Name: SPURGE2 (SafePURGE II)
Usage: Identical to SPURGE
Results: The only difference is that SPURGE2 will save the values of
variables that are purged as a group using a list or variable
names. The values of all of the variables will be put into
a list in the order in which they appeared in the purging list
and that list is stored in 'TVAR'. NOTE: The list should only
contain variable names (not tagged) and nested lists are not
supported. If the list contains elements that are not un-
tagged variable names, everything in the list will be purged;
however, only the values of the untagged variables will be saved
in the list in 'TVAR'.
Program in downloadable format:
-------------------8<------------------8<------------------8<--------
%%HP: T(3)A(R)F(.);
\<< DUP TYPE \-> n t
\<<
IF t 12 ==
THEN n OBJ\->
DROP TYPE 't' STO
END
IF t 19 ==
THEN n PURGE
END
IF t 5 ==
THEN { } 'TVAR'
STO n OBJ\-> \-> q
\<< q DROPN 1 q
FOR j n j
GET DUP
IF TYPE 6
==
THEN DUP
RCL 'TVAR' STO+
PURGE
ELSE
PURGE
END
NEXT
\>>
END
IF t 6 ==
THEN PATH n RCL
n PURGE HOME 'TVAR'
STO EVAL
END
\>>
\>>
-------------------8<------------------8<------------------8<--------
Either one of these programs can be attached to the PURGE key with a
command that looks something like the following:
<< PROGRAM >> 54.2 ASN
where << PROGRAM >> is the program that you want to attach to the PURGE
key. If anyone has specific questions about the programs, please e-mail
me directly.
Sincerely,
Jason P. Meyers
JMEYERS@MTUS5.BITNET